/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Modelos;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author luisramirezmartinez SAMI 2011
 *
 */
@Entity
@Table(name = "tbl_direcciones")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblDirecciones.findAll", query = "SELECT t FROM TblDirecciones t"),
    @NamedQuery(name = "TblDirecciones.findByIddireccion", query = "SELECT t FROM TblDirecciones t WHERE t.iddireccion = :iddireccion"),
    @NamedQuery(name = "TblDirecciones.findByCalle", query = "SELECT t FROM TblDirecciones t WHERE t.calle = :calle"),
    @NamedQuery(name = "TblDirecciones.findByNoExterior", query = "SELECT t FROM TblDirecciones t WHERE t.noExterior = :noExterior"),
    @NamedQuery(name = "TblDirecciones.findByNoInterior", query = "SELECT t FROM TblDirecciones t WHERE t.noInterior = :noInterior"),
    @NamedQuery(name = "TblDirecciones.findByColonia", query = "SELECT t FROM TblDirecciones t WHERE t.colonia = :colonia"),
    @NamedQuery(name = "TblDirecciones.findByCp", query = "SELECT t FROM TblDirecciones t WHERE t.cp = :cp")})
public class TblDirecciones implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id_direccion", nullable = false)
    private Integer iddireccion;
    @Column(name = "Calle", length = 45)
    private String calle;
    @Column(name = "NoExterior")
    private Integer noExterior;
    @Column(name = "NoInterior", length = 10)
    private String noInterior;
    @Column(name = "Colonia", length = 35)
    private String colonia;
    @Column(name = "Cp")
    private Integer cp;
    @JoinColumn(name = "Id_cliente", referencedColumnName = "Id_cliente", nullable = false)
    @ManyToOne(optional = false)
    private TblClientes idcliente;
    public TblDirecciones(){

    }

    public TblDirecciones(Integer iddireccion) {
        this.iddireccion = iddireccion;
    }

    public Integer getIddireccion() {
        return iddireccion;
    }

    public void setIddireccion(Integer iddireccion) {
        this.iddireccion = iddireccion;
    }

    public String getCalle() {
        return calle;
    }

    public void setCalle(String calle) {
        this.calle = calle;
    }

    public Integer getNoExterior() {
        return noExterior;
    }

    public void setNoExterior(Integer noExterior) {
        this.noExterior = noExterior;
    }

    public String getNoInterior() {
        return noInterior;
    }

    public void setNoInterior(String noInterior) {
        this.noInterior = noInterior;
    }

    public String getColonia() {
        return colonia;
    }

    public void setColonia(String colonia) {
        this.colonia = colonia;
    }

    public Integer getCp() {
        return cp;
    }

    public void setCp(Integer cp) {
        this.cp = cp;
    }

    public TblClientes getIdcliente() {
        return idcliente;
    }

    public void setIdcliente(TblClientes idcliente) {
        this.idcliente = idcliente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddireccion != null ? iddireccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblDirecciones)) {
            return false;
        }
        TblDirecciones other = (TblDirecciones) object;
        if ((this.iddireccion == null && other.iddireccion != null) || (this.iddireccion != null && !this.iddireccion.equals(other.iddireccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.calle +" Número: "+this.noExterior;
    }

}
